package com.yy.QSManage.exception;


import com.yy.QSManage.enums.ErrorCodeEnum;
import lombok.Getter;

/**
 * 基础异常
 */
@Getter
public class ServiceException extends RuntimeException {

    private Integer code;
    private boolean isShow = true;

    public ServiceException() {
        super();
    }

    public ServiceException(ErrorCodeEnum errorCodeEnum, Object... params) {
        super(ErrorCodeEnum.getMsg(errorCodeEnum,params));
        this.code = errorCodeEnum.getCode();
    }

    public ServiceException(ErrorCodeEnum errorCodeEnum) {
        super(errorCodeEnum.getMsg());
        this.code = errorCodeEnum.getCode();
    }
    public ServiceException(ErrorCodeEnum errorCodeEnum, boolean isShow) {
        super(errorCodeEnum.getMsg());
        this.code = errorCodeEnum.getCode();
        this.isShow = isShow;
    }
    public ServiceException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }
    public ServiceException(Integer code, String msg, boolean isShow) {
        super(msg);
        this.code = code;
        this.isShow = isShow;
    }

    public ServiceException(String message) {
        super(message);
        this.code = 0;
    }

    public ServiceException(String message, Throwable cause) {
        super(message, cause);
    }

    public ServiceException(Throwable cause) {
        super(cause);
    }

    protected ServiceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
}
